package com.zmsk.zmio.handler;

import android.content.Context;
import android.util.Log;

import com.example.jni.DeviceJNI;
import com.zmsk.zmio.inter.IIOHandler;

public class S700Handler implements IIOHandler {
    @Override
    public void initIOControl(Context context) {

    }

    @Override
    public void stopIOControl(Context context) {

    }

    @Override
    public void noticeGateOpen(Context context, String idNumber) {
        try {
            // S700 IO
            DeviceJNI deviceJNI = new DeviceJNI();
            deviceJNI.gpioOpen();
            deviceJNI.gpioSendcmd(59, 1);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void noticeGateClose(Context context) {
        try {
            DeviceJNI deviceJNI = new DeviceJNI();
            deviceJNI.gpioOpen();
            deviceJNI.gpioSendcmd(59, 0);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void noticeWhiteLedOn(Context context) {
//        Log.d("S700Handler", "openLightForS700");
//        DeviceJNI jni = new DeviceJNI();
//        jni.gpioOpen();
//        jni.gpioSendcmd(59, 1);
    }

    @Override
    public void noticeWhiteLedOff(Context context) {
//        Log.d("S700Handler", "closeLightForS700");
//        DeviceJNI jni = new DeviceJNI();
//        jni.gpioOpen();
//        jni.gpioSendcmd(59, 0);
    }

    @Override
    public void noticeInfraredLedOn(Context context) {

    }

    @Override
    public void noticeInfraredLedOff(Context context) {

    }

    @Override
    public void noticeRedLedOn(Context context) {

    }

    @Override
    public void noticeRedLedOff(Context context) {

    }

    @Override
    public void noticeGreenLedOn(Context context) {

    }

    @Override
    public void noticeGreenLedOff(Context context) {

    }

    @Override
    public void handleSlientInstall(String path) {

    }
}
